<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function floatP(a){
            let len = a.length
            for(let i = 0;i < len - 1; i++){ // 需要n-1趟
                for(let j = 0; j < len - i - 1; j++){
                    // 从小到大
                    console.log('12')
                    if(a[j] > a[j + 1]){
                        let temp = a[j + 1]
                        a[j + 1] = a[j]
                        a[j] = temp
                    }
                }
            }
        }
        let arr = [12,35,99,18,76,11,13,12,0,50]
        floatP(arr)
        console.log(arr)
    </script>
</body>
</html>